package cn.jinzhu.stream;

import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
//消息接受器
//用来绑定某个消息通道，Sink默认消息通道 input是通道的监听器
@EnableBinding(Sink.class)  //stream里面的与微服务消息进行绑定的开启绑定的注解
public class MsgReceiver {
    //相当于别人发来消息这里可以接受到，用stream注解监听。不再是消息中间件的监听注解
    @StreamListener(Sink.INPUT) //监听的消息通道，Sink默认消息通道 input是通道的监听器
    public void receiver(Object obj){
        System.out.println("收到消息"+obj);
    }
}
